export default {
  mode: 'universal',

  env: {
    // 认证客户端URL， process.env.authURL
    authURL: process.env.NODE_ENV === 'dev' ? '//localhost:7000' : '//login.douziqianduan.icu',

    // 管理后台地址
    adminURL: process.env.NODE_ENV === 'dev' ? '//localhost:7000' : '//admin.douziqianduan.icu'
  },

  /*
  ** Headers of the page
  */
  head: {
    title: '豆子前端日记',
    meta: [
      {charset: 'utf-8'},
      {name: 'viewport', content: 'width=device-width, initial-scale=1'},
      {hid: 'description', name: 'description', content: 'IT技术交流，前端，后端，问答'}
    ],
    link: [
      {rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'}
    ]
  },

  axios: {
    proxy: true, //开启代理转发
    prefix: '/api' // 请求接口添加前缀 /api   /test > /api/test
  },
  proxy: { // 代理转发
    // /api/test > http://mengxuegu.com:7300/mock/5ee6e6a9e56c02034c4c2e89/blog-web/test
    '/api/v1': {
      target: 'http://mengxuegu.com:7300/mock/5f86af236fc18c2f51b551c0/VueBlog',
      pathRewrite: {'^/api/v1': ''}
    },
    '/api': {
      // target: 'http://mengxuegu.com:7300/mock/5ee6e6a9e56c02034c4c2e89/blog-web',
      // target: 'http://mengxuegu.com:7300/mock/5f86af236fc18c2f51b551c0/VueBlog',
      // target: process.env.NODE_ENV === 'dev' ? 'http://mengxuegu.com:7300/mock/5f86af236fc18c2f51b551c0/VueBlog' : 'http//api.douziqianduan.icu',
      target: 'http://api.douziqianduan.icu',
      // target: 'http://127.0.0.1:6001',
      pathRewrite: {'^/api': ''}
    }
  },

  /*
  ** Customize the progress-bar color
  */
  loading: {color: '#fff'},
  /*
  ** Global CSS
  */
  css: [
    // 全局引入样式
    // 针对 element-ui 组件的各种样式
    'element-ui/lib/theme-chalk/index.css',
    // 自定义主题样式
    '@/assets/theme/index.css',
    // 布局样式
    'element-ui/lib/theme-chalk/display.css',
    // 项目自定义的全局样式
    '@/assets/css/global.css',

    // 加上 mavon-editor 组件要使用的样式 ++++
    'mavon-editor/dist/css/index.css'

  ],
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '~/plugins/element-ui.js',
    '~/plugins/interceptor.js',
    // 客户端渲染，
    {src: '~/plugins/mavon-edit', mode: 'client'},

    // 自定义指令
    {src: '~/directive/test', mode: 'client'},
    {src: '~/directive/imgLazy', mode: 'client'},


    //  注入封装好的api请求函数
    '~/api/article.js',
    '~/api/common.js',
    '~/api/test.js',
    '~/api/question.js',
    '~/api/user.js',
    '~/api/wallpaper.js',
  ],
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [],
  /*
  ** Nuxt.js modules
  */
  modules: [
    '@nuxtjs/axios',
    'cookie-universal-nuxt', // 针对服务端操作cookie
  ],
  /*
  ** Build configuration
  */
  build: {
    // 将位于 node_modules 目录下的element-ui导出
    transpile: [/^element-ui/],
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {
    }
  }
}
